package com.lxmes.pm.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.lxmes.common.annotation.Log;
import com.lxmes.common.core.controller.BaseController;
import com.lxmes.common.core.domain.AjaxResult;
import com.lxmes.common.enums.BusinessType;
import com.lxmes.pm.domain.ATeamUserInfo;
import com.lxmes.pm.service.IATeamUserInfoService;
import com.lxmes.common.utils.poi.ExcelUtil;
import com.lxmes.common.core.page.TableDataInfo;

/**
 * 团队人员信息Controller
 * 
 * @author zhangzhiyu
 * @date 2023-04-04
 */
@RestController
@RequestMapping("/pm/teamUserInfo")
public class ATeamUserInfoController extends BaseController
{
    @Autowired
    private IATeamUserInfoService aTeamUserInfoService;

    /**
     * 查询团队人员信息列表
     */
    @PreAuthorize("@ss.hasPermi('pm:teamUserInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(ATeamUserInfo aTeamUserInfo)
    {
        startPage();
        List<ATeamUserInfo> list = aTeamUserInfoService.selectATeamUserInfoList(aTeamUserInfo);
        return getDataTable(list);
    }

    /**
     * 导出团队人员信息列表
     */
    @PreAuthorize("@ss.hasPermi('pm:teamUserInfo:export')")
    @Log(title = "团队人员信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ATeamUserInfo aTeamUserInfo)
    {
        List<ATeamUserInfo> list = aTeamUserInfoService.selectATeamUserInfoList(aTeamUserInfo);
        ExcelUtil<ATeamUserInfo> util = new ExcelUtil<ATeamUserInfo>(ATeamUserInfo.class);
        util.exportExcel(response, list, "团队人员信息数据");
    }

    /**
     * 获取团队人员信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('pm:teamUserInfo:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(aTeamUserInfoService.selectATeamUserInfoById(id));
    }

    /**
     * 新增团队人员信息
     */
    @PreAuthorize("@ss.hasPermi('pm:teamUserInfo:add')")
    @Log(title = "团队人员信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ATeamUserInfo aTeamUserInfo)
    {
        return toAjax(aTeamUserInfoService.insertATeamUserInfo(aTeamUserInfo));
    }

    /**
     * 修改团队人员信息
     */
    @PreAuthorize("@ss.hasPermi('pm:teamUserInfo:edit')")
    @Log(title = "团队人员信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ATeamUserInfo aTeamUserInfo)
    {
        return toAjax(aTeamUserInfoService.updateATeamUserInfo(aTeamUserInfo));
    }

    /**
     * 删除团队人员信息
     */
    @PreAuthorize("@ss.hasPermi('pm:teamUserInfo:remove')")
    @Log(title = "团队人员信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(aTeamUserInfoService.deleteATeamUserInfoByIds(ids));
    }
}
